﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class Variable
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class Variable
   ">
    <meta name="generator" content="docfx 2.18.2.0">
    
    <link rel="shortcut icon" href="../../favicon.ico">
    <link rel="stylesheet" href="../../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../../styles/docfx.css">
    <link rel="stylesheet" href="../../styles/main.css">
    <meta property="docfx:navrel" content="../../toc.html">
    <meta property="docfx:tocrel" content="../toc.html">
    
    
  </head>
  <body data-spy="scroll" data-target="#affix">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../../index.html">
                <img id="logo" class="svg" src="../../logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="TensorFlow.Variable">
  
  
  <h1 id="TensorFlow_Variable" data-uid="TensorFlow.Variable">Class Variable
  </h1>
  <div class="markdown level0 summary"><p>The Variable class holds the TFOutput nodes that are used to initialize, read and assign a value to a variable.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><span class="xref">System.Object</span></div>
    <div class="level1"><span class="xref">Variable</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="../TensorFlow.html">TensorFlow</a></h6>
  <h6><strong>Assembly</strong>: TensorFlowSharp.dll</h6>
  <h5 id="TensorFlow_Variable_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class Variable</code></pre>
  </div>
  <h5 id="TensorFlow_Variable_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>A variable maintains state in the graph across calls to <code>run()</code>. You add a
            variable to the graph by constructing an instance of the class <code>Variable</code>.</p>
<pre><code>        The `Variable()` constructor requires an initial value for the variable,
        which can be a `Tensor` of any type and shape. The initial value defines the
        type and shape of the variable. After construction, the type and shape of
        the variable are fixed. The value can be changed using one of the assign
        methods.

        When a variable is created a VarHandleOp is created which is returned as 
        the VariableOp property, an assign operation is created that can be accessed
        using the assignHandle and you can read the value of the variable using the
        ReadHandle.

        When you launch the graph, variables have to be explicitly initialized before
        you can run Ops that use their value. You can initialize a variable by
        running its *initializer op*, restoring the variable from a save file, or
        simply running an `assign` Op that assigns a value to the variable. In fact,
        the variable *initializer op* is just an `assign` Op that assigns the
        variable&#39;s initial value to the variable itself.

        There is an implicit conversion from the Variable into the VarHandleOp if
        used.
</code></pre></div>
  <h3 id="properties">Properties
  </h3>
  
  
  <a id="TensorFlow_Variable_Assign_" data-uid="TensorFlow.Variable.Assign*"></a>
  <h4 id="TensorFlow_Variable_Assign" data-uid="TensorFlow.Variable.Assign">Assign</h4>
  <div class="markdown level1 summary"><p>Returns the AssignVariableOp that is used to assign the initial value to the variable from the graph.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TensorFlow.TFOperation Assign { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="TensorFlow.TFOperation.html">TFOperation</a></td>
        <td><p>The assign op.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="TensorFlow_Variable_Read_" data-uid="TensorFlow.Variable.Read*"></a>
  <h4 id="TensorFlow_Variable_Read" data-uid="TensorFlow.Variable.Read">Read</h4>
  <div class="markdown level1 summary"><p>Returns the ReadVariableOp that is used to fetch the value of the variable from the graph.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TensorFlow.TFOutput Read { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="TensorFlow.TFOutput.html">TFOutput</a></td>
        <td><p>The read op.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="TensorFlow_Variable_VariableOp_" data-uid="TensorFlow.Variable.VariableOp*"></a>
  <h4 id="TensorFlow_Variable_VariableOp" data-uid="TensorFlow.Variable.VariableOp">VariableOp</h4>
  <div class="markdown level1 summary"><p>Returns the VarHandleOp that was created using the shape of the initial value.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TensorFlow.TFOutput VariableOp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="TensorFlow.TFOutput.html">TFOutput</a></td>
        <td><p>The variable op.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="operators">Operators
  </h3>
  
  
  <a id="TensorFlow_Variable_op_Implicit_" data-uid="TensorFlow.Variable.op_Implicit*"></a>
  <h4 id="TensorFlow_Variable_op_Implicit_TensorFlow_Variable_to_TensorFlow_TFOutput_" data-uid="TensorFlow.Variable.op_Implicit(TensorFlow.Variable to TensorFlow.TFOutput)">op_Implicit(Variable to TFOutput)</h4>
  <div class="markdown level1 summary"><p>Returns the VarHandleOp (the VariableOp property).</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static TensorFlow.TFOutput op_Implicit (TensorFlow.Variable variable);</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="TensorFlow.Variable.html">Variable</a></td>
        <td><span class="parametername">variable</span></td>
        <td><p>Variable reference.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="TensorFlow.TFOutput.html">TFOutput</a></td>
        <td><p>The variable handle created for the variable.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="TensorFlow_Variable_op_Implicit_TensorFlow_Variable_to_TensorFlow_TFOutput__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This implicit operator exists to preserve the compatibility with code that
            created Variables and expected the result to be the VariableOp.</p>
</div>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
              <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Copyright © 2015-2017 Microsoft<br>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../../styles/docfx.js"></script>
    <script type="text/javascript" src="../../styles/main.js"></script>
  </body>
</html>
